﻿import 'dart:convert';
import 'dart:io';

import 'package:azring/core/models/sleep_detail.dart';
import 'package:azring/core/network/dio_client.dart';
import 'package:dio/dio.dart' as dio;
import 'package:azring/core/network/api_helper.dart';
import 'package:azring/core/models/ring_sport_record.dart';
import 'package:azring/core/models/ring_sport_detail.dart';
import 'package:azring/entity/health_questionnaire.dart';
import 'package:getx_scaffold/common/index.dart';

class DefaultApi {
  static final DefaultApi _instance = DefaultApi._internal();

  DefaultApi._internal();

  // 单例公开访问�?
  factory DefaultApi() => _instance;

  static const String addSportRecordPostPath =
      '/ring/app/ring_sport_record/add'; //上报运动记录

  static const String getSportRecordGetPath =
      '/ring/app/ring_sport_record/latest'; //获取最新运动记�?

  static const String addSportDetailPostPath =
      '/ring/app/ring_sport_detail/add'; //上报运动明细

  static const String getSportListGetPath =
      '/ring/ring_sport_record/list'; //历史运动记录

  static const String addDailyTagsPostPath =
      '/ring/app/physical_condition/add-daily-tag'; //上报事件小计

  static const String updateDailyTagsPostPath =
      '/ring/app/physical_condition/upd-daily-tag'; //修改事件小记评分

  static const String getDailyTagsListGetPath =
      '/ring/app/physical_condition/query-daily-tags-list'; //首页显示事件小计

  static const String queryDailyTagByTypeGetPath =
      '/ring/app/physical_condition/query-daily-tag-conf'; //获取某一类型对应标签集合

  static const String queryDailyTagsListGetPath =
      '/ring/app/physical_condition/query--daily-tags-conf-list'; //查询按标签类型分组列�?

  static const String addDailyTagPostPath =
      '/ring/app/physical_condition/add-daily-tag-conf'; //增加标签内容

  static const String getActionRecordListGetPath =
      '/ring/app/action_record/query-list'; //查询行动列表

  static const String addHeartRatePostPath =
      '/ring/app/ring_heart_rate/add-heart-rate'; //上报心率记录

  static const String queryExerciseRecordsGetPath =
      '/ring/app/physical_condition/query-exercise_records'; //身体状况锻炼记录

  static const String queryPhysicalActivitiesGetPath =
      '/ring/app/physical_condition/query-physical-ctivities'; //身体状况活动

  static const String queryHeartRateListGetPath =
      '/ring/app/ring_heart_rate/query-list'; //获取心率列表

  static const String addHeartRateInfoPostPath =
      '/ring/app/ring_heart_rate_info/add-heart-rate-info'; //上报心率信息列表

  static const String addHrvInfoPostPath =
      "/ring/app/ring_hrv_Info/add-ring_hrv-info"; //上报心率变异性列�?

  static const String addBloodOxygenDetailPostPath =
      '/ring/app/ring_blood_oxygen_detail/add-blood-oxygen-detail'; //上报血氧详�?

  static const String addBloodOxygenPostPath =
      '/ring/app/ring_blood_oxygen/add-blood-oxygen'; //上报血氧记�?

  static const String getHeartRateInfoGetPath =
      '/ring/app/ring_heart_rate_info/query-heart-rate-info'; //获取心率信息列表

  static const String addHrvPostPath = '/ring/app/ring_hrv/add-hrv'; //上报HRV记录

  static const String sendSmsChinaGetPath = '/sendSms/china'; //短信（国内）

  static const String sendSmsInternationalGetPath =
      '/sendSms/international'; //短信（国际）

  static const String addTodaySignPostPath =
      '/ring/app/physical_condition/add-today-sign '; //生成今日�?

  static const String addAutomaticShareSignPostPath =
      '/ring/app_interactive_sharing/add-automatic-share-sign'; //自动分享今日�?

  static const String queryDashboardGetPath =
      '/ring/app/physical_condition/query-dashboard-metrics'; //身体状况生命关键指标看板

  static const String addFoodInfoPostPath =
      '/ring/app/physical_condition/add-food-info'; //上报饮食记录

  static const String queryFoodInfoListGetPath =
      '/ring/app/physical_condition/query-user-food-info-list'; //查询饮食记录列表

  static const String addEmoionalInfoPostPath =
      '/ring/app/physical_condition/add-emotional-info-state'; //上报情绪状�?

  static const String addStressChangeInfoPostPath =
      '/ring/app/ring_stress_change_info/add-stress-change-info'; //上报压力信息

  static const String addExerciseDetailPostPath =
      '/ring/app/ring_exercise_detail/add-exercise-detail'; //上报锻炼详情

  // ---------创建计划相关-----------------

  static const String queryExerciseInfoGetPath =
      '/ring/app/ring_health_plan/query-exercise-info/:stepCount'; //通过步数计算每日摄入卡路里，运动消耗时长、运动消耗卡路里

  static const String queryPlanHrvInfoGetPath =
      '/ring/app/ring_health_plan/query-plan-hrv-info'; //获取平均心率变异�?

  static const String addHealthPlanPostPath =
      '/ring/app/ring_health_plan/add-health-plan'; //健康计划上报-app(单独上报 �?所有状态保存并启用新计�?

  static const String enableHealthPlanPostPath =
      '/ring/app/ring_health_plan/enable-health-plan'; //启用计划

  static const String updHealthPlanPostPath =
      '/ring/app/ring_health_plan/upd-health-plan'; //健康计划编辑

  static const String queryHealthPlanDetailGetPath =
      '/ring/app/ring_health_plan/query-id/:queryId'; //获取健康计划详细信息

  static const String queryHealthPlanListGetPath =
      '/ring/app/ring_health_plan/query-list'; //查询健康计划列表

  static const String claimPointsPostPath =
      '/ring/app/ring_health_plan/claim-points'; //领取积分

  // ---------睡眠相关-----------------
  static const String addSleepDetailPostPath =
      "/ring/app/sleep/home/add-detail"; //上报睡眠详情

  //---------设备相关-----------------
  static const String addDevicePostPath =
      "/ring/app/ring_device/add/device"; //绑定设备

  //--------健康问卷相关-------------
  static const String queryQuestionGetPath =
      "/ring/app/health_question_answer/query-user-health-question"; //获取问卷答案详细信息

  static const String addQuestionPostPath =
      "/ring/app/health_question_answer/add-health-question-answer"; //上报健康问卷

  //--------生理期相�?------------
  static const String addOrEditPhysiologyPostPath =
      "/ring/app/user_physiology/add-or-edit"; //新增或修改生理期信息

  static const String queryPhysiologyInfoGetPath =
      "/ring/app/user_physiology/query-physiology-info"; //获取生理期信息详细信�?

  static const String queryReminderInfoGetPath =
      "/ring/app/user_physiology_set/query-reminder-info"; //获取生理周期通知信息

  static const String reminderInfoPutPath =
      "/ring/app/user_physiology_set/reminder-info"; //新增或修改生理周期通知信息

  static const String querySetInfoGetPath =
      "/ring/app/user_physiology_set/query-set-info"; //获取生理周期设置详细信息

  static const String setInfoPostPath =
      "/ring/app/user_physiology_set/set-info"; //新增或修改生理周期设�?

  static const String addMyInfoPostPath =
      "/ring/app/ring_my_info/add-my-info"; //新增戒指固件信息

  static const String queryWarrantyStatusGetPath =
      "/ring/app/ring_my_info/query-warranty-status"; //获取戒指保修状�?

  static const String queryFirmwareInfoGetPath =
      "/ring/app/ring_my_info/query-firmware-info"; //获取戒指固件信息

  static const String addFeedbackPostPath =
      "/ring/app/ring_my_opinion_feedback/add-feedback"; //新增我的意见反馈

  static const String queryFeedbackGetPath =
      "/ring/app/ring_my_opinion_feedback/query-feedback/:id"; //获取我的意见反馈详细信息

  static const String queryFeedbackListGetPath =
      "/ring/app/ring_my_opinion_feedback/query-feedback-list"; //查询我的意见反馈列表

  static const String dataTypeGetPath =
      '/system/dict/data/type/:dictType'; //系统字典

  static const String queryEventSubtotalListGetPath =
      '/ring/app/event_subtotal_second/query-event-subtotal-list'; //二级事件小计

  static const String queryEventInfoGetPath =
      '/ring/app/event_info_second/query-event-info'; //二级�?活动

  static const String queryEventExerciseInfoGetPath =
      '/ring/app/event_info_second/query-event-exercise-info'; //二级�?锻炼记录

  static const String queryCompareDistanceRateGetPath =
      '/ring/app/event_info_second/query-compare-distance-rate'; //二级�?对比走的距离

  static const String queryTargetSituationGetPath =
      '/ring/app/event_info_second/query-target-situation'; //二级�?过去七天达成目标情况

  static const String queryPhysicalActivityLevelGetPath =
      '/ring/app/event_info_second/query-physical-activity-level'; //二级�?体力活动�?

  static const String queryPressureAverageGetPath =
      '/ring/app/ring_pressure_second/query-pressure-average'; //二级�?压力平均�?

  static const String queryPressureMonitorGetPath =
      '/ring/app/ring_pressure_second/query-pressure-monitor'; //二级�?压力比例

  static const String queryPressureInfoGetPath =
      '/ring/app/ring_pressure_second/query-pressure-info'; //三级�?统计-手动测量记录

  static const String queryHrvAverageGetPath =
      '/ring/app/ring_hrv_second/query-hrv-average'; //二级�?心率变异性平均�?

  static const String queryHeartRateAverageGetPath =
      '/ring/app/ring_heart_rate_second/query-heart-rate-average'; //二级�?心率平均�?

  static const String querySportHeartRateGetPath =
      '/ring/app/ring_heart_rate_second/query-sport-heart-rate'; //二级�?运动期间心率

  static const String querySleepHeartRateSecondGetPath =
      '/ring/app/ring_heart_rate_second/query-sleep-heart-rate'; //二级�?平均睡眠心率

  static const String queryBloodOxygenAverageGetPath =
      '/ring/app/ring_blood_second/query-blood-oxygen-average'; //二级�?血氧平均�?

  static const String queryBloodOxygenMonitorGetPath =
      '/ring/app/ring_blood_second/query-blood-oxygen-monitor'; //二级�?夜间血氧监�?

  // 三级�?统计-手动测量记录接口
  static const String queryBloodOxygenInfoGetPath =
      '/ring/app/ring_blood_second/query-blood-oxygen-info'; //三级�?血氧统�?手动测量记录

  static const String queryHrvInfoGetPath =
      '/ring/app/ring_hrv_second/query-hrv-info'; //三级�?心率变异性统�?手动测量记录

  // 四级�?手动测量详情和历史数据接�?
  static const String queryBloodOxygenDetailGetPath =
      '/ring/app/ring_blood_second/query-blood-oxygen-detail/:id'; //四级�?手动血氧详�?

  static const String queryBloodOxygenSevenInfoGetPath =
      '/ring/app/ring_blood_second/query-blood-oxygen-seven-info'; //四级�?当天往前取7条数�?

  static const String queryPressureDetailGetPath =
      '/ring/app/ring_pressure_second/query-pressure-detail/:id'; //四级�?手动压力详情

  static const String queryPressureSevenInfoGetPath =
      '/ring/app/ring_pressure_second/query-pressure-seven-info'; //四级�?当天往前取7条数�?

  static const String queryHrvDetailGetPath =
      '/ring/app/ring_hrv_second/query-hrv-detail/:id'; //四级�?心率变异性手动详�?

  static const String queryHrvSevenInfoGetPath =
      '/ring/app/ring_hrv_second/query-hrv-seven-info'; //四级�?当天往前取7条数�?

  static const String queryHeartRateDetailGetPath =
      '/ring/app/ring_heart_rate_second/query-heart-rate-detail/:id'; //四级�?心率手动详情

  static const String queryHeartRateSevenInfoGetPath =
      '/ring/app/ring_heart_rate_second/query-heart-rate-seven-info'; //四级�?当天往前取7条数�?

  static const String queryFoodListGetPath =
      '/ring/app/food_info_second/query-food-list'; //三级�?饮食统计

  static const String queryExerciseListGetPath =
      '/ring/app/ring_exercise_detail_second/query-exercise-list'; //二级�?锻炼列表�?

  static const String queryExerciseDetailGetPath =
      '/ring/app/ring_exercise_detail_second/query-exercise-detail/:id'; //三级�?详情信息

  static const String queryExerciseHeartRateGetPath =
      '/ring/app/ring_exercise_detail_second/query-exercise-heart-rate/:id'; //三级�?平均心率

  static const String queryExerciseIntervalGetPath =
      '/ring/app/ring_exercise_detail_second/query-exercise-interval/:id'; //三级�?心率区间

  static const String queryExerciseCadenceInfoGetPath =
      '/ring/app/ring_exercise_detail_second/query-exercise-cadence-info/:id'; //三级�?步频&步长

  static const String queryExerciseInfoListGetPath =
      '/ring/app/ring_exercise_detail_second/query-exercise-info-list'; //查询锻炼信息列表

  static const String querySleepBloodOxygenGetPath =
      '/ring/app/physical_condition/query-sleep-blood-oxygen'; //血氧饱和度

  static const String querySleepInfoGetPath =
      '/ring/app/physical_condition/query-info'; //睡眠内容详情

  static const String addEventInfoPostPath =
      '/ring/app/ring_event_info/add-event-info'; //睡眠活动状�?

  static const String queryFoodInfoGetPath =
      '/ring/app/food_info_second/query-food-info'; //饮食记录

  static const String sleepQueryListGetPath =
      '/ring/app/sleep/home/query-list'; //查询睡眠详情列表

  static const String queryQualityScoreGetPath =
      '/ring/app/sleep/home/query-quality-score'; //睡眠质量评分

  static const String queryProportionGetPath =
      '/ring/app/sleep/home/query-proportion'; //睡眠比例

  static const String querySleepHeartRateGetPath =
      '/ring/app/sleep/home/query-sleep-heart-rate'; //平均睡眠心率

  static const String querySleepHrvGetPath =
      '/ring/app/sleep/home/query-sleep-hrv'; //平均心率变异�?

  static const String querySleepActivityStatusGetPath =
      '/ring/app/sleep/home/query-sleep-activity-status'; //睡眠活动状�?

  static const String queryUserGetPath = '/ring/app/user/queryUser'; //获取个人信息

  static const String uploadAvatarPostPath =
      '/ring/app/user/uploadAvatar'; //上传头像

  static const String editUserPutPath = '/ring/app/user/editUser'; //修改用户

  static const String resetPwdPutPath = '/ring/app/user/updatePwd'; //重置密码

  static const String operationReminderSetPostPath =
      '/ring/app/ring_my_reminder_set/operation-reminder-set'; //操作提醒设置

  static const String queryReminderSetGetPath =
      '/ring/app/ring_my_reminder_set/query-reminder-set'; //获取提醒设置

  static const String operationMyOtherSetPostPath =
      '/ring/app/ring_my_other_set/operation-my-other-set'; //操作戒指其他设置

  static const String queryMyOtherSetGetPath =
      '/ring/app/ring_my_other_set/query-my-other-set'; //获取戒指其他设置

  static const String ringAppVersionQueryPlatformGetPath =
      '/ring/app/version/query/:platform'; //获取版本

  static const String editLayoutPutPath =
      '/ring/app/ring_physical_condition_layout/edit-layout'; //修改身体状况布局

  static const queryRingTodaySignListGetPath =
      '/ring/app/physical_condition/query-ring-today-sign-list'; //今日签列�?

  static const String queryLayoutList =
      '/ring/app/ring_physical_condition_layout/query-layout-list'; //查询身体状况布局

  static const String queryInitializationLayoutListGetPath =
      '/ring/app/physical_layout_initialization/query-list'; //身体状况布局初始化列�?

  static const queryConditionScoreGetPath =
      '/ring/app/physical_condition/query-condition-score'; //身体状况评分

  static const queryEmotionalInfoStateGetPath =
      '/ring/app/physical_condition/query-emotional-info-state'; //查询情绪和压�?
  static const queryHeartRateInfoGetPath =
      '/ring/app/physical_condition/query-heart-rate-info';
  static const queryRingHrvInfoGetPath =
      '/ring/app/physical_condition/query-ring_hrv-info'; //hrv
  static const querySleepTrendGetPath =
      '/ring/app/sleep/home/query-sleep-trend'; //�?天睡眠趋�?

  static const queryShortSleepGetPath =
      '/ring/app/sleep/home/query-short-sleep'; //小睡数据

  static const queryWeekMonthSleepDetailGetPath =
      '/ring/app/sleep/home/query-week-or-month-sleep'; //�?月睡眠详�?

  static const queryMenstrualCycleGetPath =
      '/ring/app/physical_condition/query-menstrual-cycle'; //首页生理周期

  static const String queryShopProductsGetPath =
      '/shop/shop_products/query'; //查询积分商城产品列表

  static const String queryShopProductDetailGetPath =
      '/shop/shop_products'; //查询商品详情

  static const String exchangeProductPostPath =
      '/shop/shop_points_orders/exchange'; //积分商品兑换

  static const String queryShopPointsOrdersGetPath =
      '/shop/shop_points_orders/query'; //查询兑换订单列表

  static const String queryShopPointsOrderDetailGetPath =
      '/shop/shop_points_orders'; //查询兑换订单详情

  static const String queryShopPointsIncomeGetPath =
      '/shop/shop_points_income/query'; //查询积分明细

  static const String addShippingAddressPostPath =
      '/shop/shop_user_addresses/add'; //新增收货地址

  static const String updateShippingAddressPutPath =
      '/shop/shop_user_addresses'; //修改收货地址

  static const String deleteShippingAddressDelPath =
      '/shop/shop_user_addresses/:ids'; //删除收货地址

  static const String queryShippingAddressDetailGetPath =
      '/shop/shop_user_addresses/:id'; //收货地址详情

  static const String queryShippingAddressListGetPath =
      '/shop/shop_user_addresses/query'; //收货地址列表

  static const String queryProvinceGetPath =
      '/shop/shop_address/province'; //获取省市区数�?

  // 日历查询接口
  static const querySleepCalendarListGetPath =
      '/ring/app/sleep/home/query-calendar-list'; //睡眠日历

  static const queryBloodOxygenCalendarListGetPath =
      '/ring/app/ring_blood_second/query-calendar-list'; //血氧日�?

  static const queryPressureCalendarListGetPath =
      '/ring/app/ring_pressure_second/query-calendar-list'; //压力日历

  static const queryHrvCalendarListGetPath =
      '/ring/app/ring_hrv_second/query-calendar-list'; //心率变异性日�?

  static const queryHeartRateCalendarListGetPath =
      '/ring/app/ring_heart_rate_second/query-calendar-list'; //心率日历

  static const queryActivityCalendarListGetPath =
      '/ring/app/event_info_second/query-calendar-list'; //活动日历

  static const String queryFoodCalendarListGetPath =
      '/ring/app/food_info_second/query-calendar-list'; //饮食日历

  static const String queryEventSubtotalCalendarListGetPath =
      '/ring/app/event_subtotal_second/query-calendar-list'; //事件小计日历

  //--------群组相关-------------
  static const String addGroupPostPath = '/ring/app_group/add-group'; //新增群组

  static const String queryGroupListGetPath =
      '/ring/app_group/query-group-list'; //查询群组列表

  static const String queryGroupGetPath =
      '/ring/app_group/query-group'; //获取群组详情

  static const String editGroupSortPutPath =
      '/ring/app_group/edit-group-sort'; //修改群组显示顺序

  static const String applyJoinGroupPostPath =
      '/ring/app_group/apply-join-group'; //申请/邀请加入群�?

  static const String queryGroupCodeByIdGetPath =
      '/ring/app_group/query-group-code-id/:id'; //获取群组码ById

  static const String queryGroupCodeGetPath =
      '/ring/app_group/query-group-code'; //获取群组�?

  static const String queryInviterMessageListGetPath =
      '/ring/app_group/query-inviter-message-list'; //查询我的邀请审批后群组消息列表

  static const String queryApplyMessageListGetPath =
      '/ring/app_group/query-apply-message-list'; //查询我的申请审批后群组消息列�?

  static const String queryApplyReviewMessageListGetPath =
      '/ring/app_group/query-apply-review-message-list'; //查询我的申请待审批群组消息列�?

  static const String approvalPutPath = '/ring/app_group/approval'; //是否同意加入群组

  static const String queryRelaxInfoListGetPath =
      '/ring/app_relax_info/query-relax-info-list'; //查询减压助眠列表

  static const String queryRelaxInfoGetPath =
      '/ring/app_relax_info/query-relax-info'; //获取减压助眠信息

  static const String queryRelaxFrequencyListGetPath =
      '/ring/app_relax_info/query-relax-frequency-list/:relaxType'; //获取减压助眠频次集合

  static const String queryStressReliefListGetPath =
      '/ring/app_relax_info/query-stress-relief-list/:minutes'; //获取减压播放返回秒对应吸气、呼气节�?

  static const String querySleepAidListGetPath =
      '/ring/app_relax_info/query-stress-aid-list/:minutes'; //获取助眠播放返回秒对应吸气、屏住呼吸、呼气节�?

  static const String aiSendPostPath = '/ring/app/ai/send'; //AI 发送消�?

  static const String queryAppNoticeListGetPath =
      '/ring/app_notice/query-app-notice-list'; //查询应用通知列表

  static const String queryAppNoticeGetPath =
      '/ring/app_notice/query-app-notice/:noticeId'; //获取应用通知详细信息

  static const String queryAppNoticeInfoGetPath =
      '/ring/app_notice/query-app-notice-info'; //获取应用通知信息（不带ID，获取最新的�?

  static const String querySleepBOGetPath =
      '/ring/app/sleep/home/query-sleep-blood-oxygen'; //血氧饱和度

  static const String sleepVerifyGetPath = '/ring/app/sleep/home/sleep-verify'; //睡眠验证

  static const String queryHeartRateMeasureGetPath =
      '/ring/app/ring_heart_rate_second/query-heart-rate-info'; //心率手动测量记录

  static const String addStressChangePostPath =
      '/ring/app/ring_stress_change/add-stress-change'; //上报压力手动测量

  static const String queryGroupMemberListGetPath =
      '/ring/app_group/query-group-member-list'; //查询成员列表

  static const String editGroupMemberRemarkPutPath =
      '/ring/app_group/edit-group-member-remark'; //修改成员备注

      static const String sleepHomeQueryInfoGetPath = "/ring/app/sleep/home/query-info";//睡眠详情

  static const String removeGroupDelPath =
      '/ring/app_group/remove-group/:id'; //解散群组

  static const String removeGroupMemberDelPath =
      '/ring/app_group/remove-group-member/:id'; //移除群组成员/退出群�?

  static const queryEnergyBalanceGetPath =
      '/ring/app/food_info_second/query-energy-balance'; //能量平衡

  static const queryPhysicalCtivitiesGetPath =
      '/ring/physical_condition/query-physical-ctivities'; //身体状况活动

  static const queryGroupPhysicalVitalityGetPath =
      '/ring/app_group/query-physical-vitality'; //群组身体活力

  static const queryGroupSleepGetPath =
      '/ring/app_group/query-sleep'; //群组睡眠

  static const queryGroupEnergyBalanceGetPath =
      '/ring/app_group/query-energy-balance'; //群组能量平衡

  static const queryShareListGetPath =
      '/ring/app_interactive_sharing/query-share-list'; //查询互动分享列表

  static const shareDeleteDelPath =
      '/ring/app_interactive_sharing/share-delete/:shareId'; //删除分享

  static const shareCommentThumbPostPath =
      '/ring/app_interactive_sharing/share-comment-thumb'; //点赞

  static const shareDeleteThumbDelPath =
      '/ring/app_interactive_sharing/share-delete-thumb/:thumbId'; //取消点赞

  static const shareCreateCommentPostPath =
      '/ring/app_interactive_sharing/share-create-comment'; //创建评论

  static const shareDeleteCommentDelPath =
      '/ring/app_interactive_sharing/share-delete-comment/:commentId'; //删除评论

  ///移除群组成员/退出群�?
  Future<T?> removeGroupMemberDel<T>({
    required String id,
    String? memberName,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: removeGroupMemberDelPath.replaceAll(':id', id),
      method: 'delete',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询群组身体活力
  Future<T?> queryGroupPhysicalVitalityGet<T>({
    required int groupId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupPhysicalVitalityGetPath,
      method: 'Get',
      queryParameters: {'groupId': groupId},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询群组睡眠
  Future<T?> queryGroupSleepGet<T>({
    required int groupId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupSleepGetPath,
      method: 'Get',
      queryParameters: {'groupId': groupId},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询群组能量平衡
  Future<T?> queryGroupEnergyBalanceGet<T>({
    required int groupId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupEnergyBalanceGetPath,
      method: 'Get',
      queryParameters: {'groupId': groupId},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询互动分享列表
  Future<T?> queryShareListGet<T>({
    required int groupId,
     String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShareListGetPath,
      method: 'Get',
      queryParameters: {'groupId': groupId, 'dailyValue': dailyValue},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///删除分享
  Future<T?> shareDeleteDel<T>({
    required int shareId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: shareDeleteDelPath.replaceAll(':shareId', shareId.toString()),
      method: 'Delete',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///点赞
  Future<T?> shareCommentThumbPost<T>({
    required int groupId,
    required int shareId,
    required int userId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: shareCommentThumbPostPath,
      method: 'Post',
      data: {
        'groupId': groupId,
        'shareId': shareId,
        'userId': userId,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///取消点赞
  Future<T?> shareDeleteThumbDel<T>({
    required int thumbId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: shareDeleteThumbDelPath.replaceAll(':thumbId', thumbId.toString()),
      method: 'Delete',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///创建评论
  Future<T?> shareCreateCommentPost<T>({
    required int groupId,
    required int shareId,
    required int userId,
    required String content,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: shareCreateCommentPostPath,
      method: 'Post',
      data: {
        'groupId': groupId,
        'shareId': shareId,
        'userId': userId,
        'content': content,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///删除评论
  Future<T?> shareDeleteCommentDel<T>({
    required int commentId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: shareDeleteCommentDelPath.replaceAll(':commentId', commentId.toString()),
      method: 'Delete',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryExerciseInfoListGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryExerciseInfoListGetPath,
      method: 'Get',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///活动
  Future<T?> queryPhysicalCtivitiesGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryPhysicalCtivitiesGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryInitializationLayoutListGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryInitializationLayoutListGetPath,
      method: 'Get',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryEnergyBalanceGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryEnergyBalanceGetPath,
      method: 'Get',
      queryParameters: {
        'deviceSn': deviceSn,
        'recordDate': recordDate,
        'type': type
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> removeGroupDel<T>({
    required String id,
    String? memberName,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: removeGroupDelPath.replaceAll(':id', id),
      method: 'delete',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> editGroupMemberRemarkPut<T>({
    int? id,
    String? memberName,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: editGroupMemberRemarkPutPath,
      method: 'Put',
      queryParameters: {'id': id, 'memberName': memberName},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryGroupMemberListGet<T>({
    int? id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupMemberListGetPath,
      method: 'Get',
      queryParameters: {
        'id': id,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> addStressChangePost<T>({
    String? deviceSn,
    String? stressChange,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addStressChangePostPath,
      method: 'Post',
      data: {'deviceSn': deviceSn, 'stressChange': stressChange},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryHeartRateMeasureGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHeartRateMeasureGetPath,
      method: 'Get',
      queryParameters: {
        'deviceSn': deviceSn,
        'recordDate': recordDate,
        'type': type
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///睡眠页的血氧饱和度
  Future<T?> querySleepBOGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: querySleepBOGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue,'type':type},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryRingTodaySignListGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryRingTodaySignListGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> queryMenstrualCycleGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryMenstrualCycleGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  Future<T?> querySleepTrendGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: querySleepTrendGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue,'type':type},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询心率变异�?
  Future<T?> queryRingHrvInfoGet<T>({
    String? deviceSn,
    String? historyDay,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryRingHrvInfoGetPath,
      method: 'Get',
      queryParameters: {
        'deviceSn': deviceSn,
        'historyDay': historyDay,
        'type': 1
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询心率信息
  Future<T?> queryHeartRateInfoGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHeartRateInfoGetPath,
      method: 'Get',
      queryParameters: {
        'deviceSn': deviceSn,
        'historyDay': dailyValue,
        'type': "1"
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询情绪和压�?
  Future<T?> queryEmotionalInfoStateGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryEmotionalInfoStateGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///获取身体状况评分
  Future<T?> queryConditionScoreGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryConditionScoreGetPath,
      method: 'Get',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取版本
  Future<T?> ringAppVersionQueryPlatformGet<T>({
    required String platform,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path:
          ringAppVersionQueryPlatformGetPath.replaceAll(':platform', platform),
      method: 'Get',
      queryParameters: {},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///重置密码
  Future<T?> resetPwdPut<T>({
    required String oldPassword,
    required String newPassword,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: resetPwdPutPath,
      method: 'Put',
      data: {'oldPassword': oldPassword, 'newPassword': newPassword},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///上传头像
  Future<T?> uploadAvatarPost<T>({
    required File avatarFile,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    final dio.FormData formData = dio.FormData.fromMap({
      'avatarfile': await dio.MultipartFile.fromFile(
        avatarFile.path,
        filename: avatarFile.path.split('/').last,
      ),
    });

    return await ApiHelper.request<T>(
      path: uploadAvatarPostPath,
      method: 'POST',
      data: formData,
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///修改用户信息
  Future<T?> editUserPut<T>({
    String? nickName,
    String? email,
    String? phonenumber,
    int? sex,
    String? avatar,
    int? height,
    int? weight,
    String? birthday,
    String? career,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: editUserPutPath,
      method: 'PUT',
      data: {
        if (nickName != null) 'nickName': nickName,
        if (email != null) 'email': email,
        if (phonenumber != null) 'phonenumber': phonenumber,
        if (sex != null) 'sex': sex,
        if (avatar != null) 'avatar': avatar,
        if (height != null) 'height': height,
        if (weight != null) 'weight': weight,
        if (birthday != null) 'birthday': birthday,
        if (career != null) 'career': career,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///获取提醒设置
  Future<T?> queryReminderSetGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryReminderSetGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///获取戒指其他设置
  Future<T?> queryMyOtherSetGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryMyOtherSetGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///操作戒指其他设置
  Future<T?> operationMyOtherSetPost<T>({
    String? deviceSn,
    String? unitFormat,
    String? temperatureUnit,
    int? intervalTime,
    int? oxygenSaturation,
    int? pressure,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: operationMyOtherSetPostPath,
      method: 'POST',
      data: {
        if (deviceSn != null) 'deviceSn': deviceSn,
        if (unitFormat != null) 'unitFormat': unitFormat,
        if (temperatureUnit != null) 'temperatureUnit': temperatureUnit,
        if (intervalTime != null) 'intervalTime': intervalTime,
        if (oxygenSaturation != null) 'oxygenSaturation': oxygenSaturation,
        if (pressure != null) 'pressure': pressure,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///操作提醒设置
  Future<T?> operationReminderSetPost<T>({
    String? deviceSn,
    String? informationReminder,
    String? lowBatteryAlert,
    String? heartRateWarn,
    String? planReminder,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: operationReminderSetPostPath,
      method: 'POST',
      data: {
        if (deviceSn != null) 'deviceSn': deviceSn,
        if (informationReminder != null)
          'informationReminder': informationReminder,
        if (lowBatteryAlert != null) 'lowBatteryAlert': lowBatteryAlert,
        if (heartRateWarn != null) 'heartRateWarn': heartRateWarn,
        if (planReminder != null) 'planReminder': planReminder,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///获取个人信息
  Future<T?> queryUserGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryUserGetPath,
      method: 'Get',
    );
  }

  ///睡眠活动状�?
  Future<T?> querySleepActivityStatusGet<T>({
    String? deviceSn,
    String? dailyValue,
    int? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySleepActivityStatusGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          if (type != null) 'type': type,
        });
  }

  ///睡眠HRV
  Future<T?> querySleepHrvGet<T>({
    String? deviceSn,
    String? dailyValue,
    int? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySleepHrvGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          if (type != null) 'type': type,
        });
  }

  ///睡眠心率
  Future<T?> querySleepHeartRateGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySleepHeartRateGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          'type':type
        });
  }

  ///睡眠比例
  Future<T?> queryProportionGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryProportionGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          'type':type
        });
  }

  ///睡眠质量评分
  Future<T?> queryQualityScoreGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryQualityScoreGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
        });
  }

  ///睡眠详情列表
  Future<T?> sleepQueryListGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? sleepType,
    String? startDate,
    String? endDate,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: sleepQueryListGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          'sleepType': sleepType,
          'startDate': startDate,
          'endDate': endDate
        });
  }

  ///获取饮食记录
  Future<T?> queryFoodInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryFoodInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type,
        });
  }

  ///活动状�?
  Future<T?> addEventInfoPost<T>({
    required String deviceSn,
    required List<Map<String, dynamic>> event,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addEventInfoPostPath,
      method: 'Post',
      data: {
        'deviceSn': deviceSn,
        'stress': event,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///睡眠首页查询
Future<T?> sleepHomeQueryInfoGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: sleepHomeQueryInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          'type': type
        });
  }
  ///查询睡眠详情
  Future<T?> querySleepInfoGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySleepInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          'type': type
        });
  }

  ///血氧饱和度
  Future<T?> querySleepBloodOxygenGet<T>({
    String? deviceSn,
    String? dailyValue,
    String? sleepType,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySleepBloodOxygenGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
          'sleepType': sleepType,
          'type': type
        });
  }

  ///活动
  Future<T?> queryPhysicalActivitiesGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryPhysicalActivitiesGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
        });
  }

  ///锻炼记录
  Future<T?> queryExerciseRecordsGet<T>({
    String? deviceSn,
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryExerciseRecordsGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'dailyValue': dailyValue,
        });
  }

  ///二级事件小计
  Future<T?> queryEventSubtotalListGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryEventSubtotalListGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?活动
  Future<T?> queryEventInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryEventInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?锻炼记录
  Future<T?> queryEventExerciseInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryEventExerciseInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?对比走的距离
  Future<T?> queryCompareDistanceRateGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryCompareDistanceRateGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?过去七天达成目标情况
  Future<T?> queryTargetSituationGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryTargetSituationGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?体力活动�?
  Future<T?> queryPhysicalActivityLevelGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryPhysicalActivityLevelGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?压力平均�?
  Future<T?> queryPressureAverageGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryPressureAverageGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?压力比例
  Future<T?> queryPressureMonitorGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryPressureMonitorGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///三级�?统计-手动测量记录
  Future<T?> queryPressureInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryPressureInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?心率变异性平均�?
  Future<T?> queryHrvAverageGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryHrvAverageGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?心率平均�?
  Future<T?> queryHeartRateAverageGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryHeartRateAverageGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?运动期间心率
  Future<T?> querySportHeartRateGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySportHeartRateGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?平均睡眠心率
  Future<T?> querySleepHeartRateSecondGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: querySleepHeartRateSecondGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?血氧平均�?
  Future<T?> queryBloodOxygenAverageGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryBloodOxygenAverageGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?夜间血氧监�?
  Future<T?> queryBloodOxygenMonitorGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryBloodOxygenMonitorGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///三级�?血氧统�?手动测量记录
  Future<T?> queryBloodOxygenInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryBloodOxygenInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///三级�?心率变异性统�?手动测量记录
  Future<T?> queryHrvInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryHrvInfoGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///三级�?饮食统计
  Future<T?> queryFoodListGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryFoodListGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        });
  }

  ///二级�?锻炼列表�?
  Future<T?> queryExerciseListGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryExerciseListGetPath,
        method: 'Get',
        queryParameters: {
          'deviceSn': deviceSn,
          'recordDate': recordDate,
          'type': type
        },
        isShowErrMsg: isShowErrMsg,
        isShowLoading: isShowLoading);
  }

  ///三级�?详情信息
  Future<T?> queryExerciseDetailGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryExerciseDetailGetPath.replaceAll(':id', id),
        method: 'Get',
        isShowErrMsg: isShowErrMsg,
        isShowLoading: isShowLoading);
  }

  ///三级�?平均心率
  Future<T?> queryExerciseHeartRateGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryExerciseHeartRateGetPath.replaceAll(':id', id),
        method: 'Get',
        isShowErrMsg: isShowErrMsg,
        isShowLoading: isShowLoading);
  }

  ///三级�?心率区间
  Future<T?> queryExerciseIntervalGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryExerciseIntervalGetPath.replaceAll(':id', id),
        method: 'Get',
        isShowErrMsg: isShowErrMsg,
        isShowLoading: isShowLoading);
  }

  ///三级�?步频&步长
  Future<T?> queryExerciseCadenceInfoGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
        path: queryExerciseCadenceInfoGetPath.replaceAll(':id', id),
        method: 'Get',
        isShowErrMsg: isShowErrMsg,
        isShowLoading: isShowLoading);
  }

  ///系统字典
  Future<T?> dataTypeGet<T>({
    required String dictType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: dataTypeGetPath.replaceAll(':dictType', dictType),
      method: 'Get',
    );
  }

  ///上报心率变异�?
  Future<T?> addHrvInfoPost<T>({
    required String deviceSn,
    required List<Map<String, dynamic>> hrv,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addHrvInfoPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
        'stress': hrv,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///绑定设备
  Future<T?> addDevicePost<T>({
    required String deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addDevicePostPath,
      method: 'POST',
      data: {"deviceSn": deviceSn},
    );
  }

  ///睡眠详情
  Future<T?> addSleepDetailPost<T>({
    required SleepDetail sleepDetail,
    required String historyDay,
    bool isShowErrMsg = false,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addSleepDetailPostPath,
      method: 'POST',
      data: sleepDetail.toJson(),
    );
  }

  /// 验证睡眠数据是否已上�?
  /// 返回未上报的睡眠记录下标列表
  Future<T?> verifySleepDataGet<T>({
    required String deviceSn,
    required List<int> dateList,
    bool isShowErrMsg = false,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: sleepVerifyGetPath,
      method: 'Get',
      data: {
        'deviceSn': deviceSn,
        'dateList': dateList,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///首页显示事件小计
  Future<T?> getDailyTagsListGet<T>({
    String? dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: getDailyTagsListGetPath,
      method: 'GET',
      queryParameters: {
        'dailyValue': dailyValue,
      },
    );
  }

  ///血氧详情上�?
  Future<T?> addBloodOxygenDetailPost<T>({
    required String bloodOxygen,
    required String deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addBloodOxygenDetailPostPath,
      method: 'POST',
      data: {
        'bloodOxygen': bloodOxygen,
        'deviceSn': deviceSn,
      },
    );
  }

  ///修改事件小计评分
  Future<T?> updateDailyTagsPost<T>({
    int? id,
    String? gameThing,
    String? recommendItems,
    String? symptomThing,
    String? eventInfo,
    String? recordScores,
    String? aiCcomments,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: updateDailyTagsPostPath,
      method: 'POST',
      data: {
        'id': id,
        'gameThing': gameThing,
        'symptomThing': symptomThing,
        'eventInfo': eventInfo,
        'recommendItems': recommendItems,
        'recordScores': recordScores,
        'aiComments': aiCcomments,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///身体状况上报事件小计
  Future<T?> addDailyTagsPost<T>({
    String? gameThing,
    String? recommendItems,
    String? symptomThing,
    String? eventInfo,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addDailyTagsPostPath,
      method: 'POST',
      data: {
        'gameThing': gameThing,
        'symptomThing': symptomThing,
        'eventInfo': eventInfo,
        'recommendItems': recommendItems,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///领取积分
  Future<T?> claimPointsPost<T>({
    required int id,
    required int planPoints,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: claimPointsPostPath,
      data: {
        'id': id,
        'planPoints': planPoints,
      },
      method: 'POST',
    );
  }

  ///查询健康计划列表
  Future<T?> queryHealthPlanListGet<T>({
    String? deviceSn,
    String? planStatus,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHealthPlanListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
        if (planStatus != null) 'planStatus': planStatus,
      },
    );
  }

  ///获取健康计划详细信息
  Future<T?> queryHealthPlanDetailGet<T>({
    required String queryId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHealthPlanDetailGetPath.replaceAll(":queryId", queryId),
      method: 'GET',
    );
  }

  ///获取平均心率变异�?
  Future<T?> queryPlanHrvInfoGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryPlanHrvInfoGetPath,
      method: 'GET',
    );
  }

  ///健康计划编辑
  Future<T?> updHealthPlanPost<T>({
    String? planAssort,
    String? planName,
    int? planCycle,
    int? planProgress,
    int? planPoints,
    String? idDefault,
    String? planStatus,
    int? stepCount,
    String? sleepQuality,
    String? restingHeartRate,
    String? heartRateVariability,
    String? bloodOxygenSaturation,
    int? exerciseDuration,
    int? exerciseCalorie,
    int? calorie,
    String? checkInEvent,
    String? emotionManagement,
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
    int? id,
  }) async {
    return await ApiHelper.request<T>(
      path: updHealthPlanPostPath,
      method: 'POST',
      data: {
        'id': id,
        'planAssort': planAssort,
        'planName': planName,
        'planCycle': planCycle,
        'planProgress': planProgress,
        'planPoints': planPoints,
        'idDefault': idDefault,
        'planStatus': planStatus,
        'stepCount': stepCount,
        'sleepQuality': sleepQuality,
        'restingHeartRate': restingHeartRate,
        'heartRateVariability': heartRateVariability,
        'bloodOxygenSaturation': bloodOxygenSaturation,
        'exerciseDuration': exerciseDuration,
        'exerciseCalorie': exerciseCalorie,
        'calorie': calorie,
        'checkInEvent': checkInEvent,
        'emotionManagement': emotionManagement,
        'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///健康计划上报
  Future<T?> addHealthPlanPost<T>({
    String? planAssort,
    String? planName,
    int? planCycle,
    int? planProgress,
    int? planPoints,
    String? idDefault,
    String? planStatus,
    int? stepCount,
    String? sleepQuality,
    String? restingHeartRate,
    String? heartRateVariability,
    String? bloodOxygenSaturation,
    int? exerciseDuration,
    int? exerciseCalorie,
    int? calorie,
    String? checkInEvent,
    String? emotionManagement,
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addHealthPlanPostPath,
      method: 'POST',
      data: {
        'planAssort': planAssort,
        'planName': planName,
        'planCycle': planCycle,
        'planProgress': planProgress,
        'planPoints': planPoints,
        'idDefault': idDefault,
        'planStatus': planStatus,
        'stepCount': stepCount,
        'sleepQuality': sleepQuality,
        'restingHeartRate': restingHeartRate,
        'heartRateVariability': heartRateVariability,
        'bloodOxygenSaturation': bloodOxygenSaturation,
        'exerciseDuration': exerciseDuration,
        'exerciseCalorie': exerciseCalorie,
        'calorie': calorie,
        'checkInEvent': checkInEvent,
        'emotionManagement': emotionManagement,
        'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///启用计划
  Future<T?> enableHealthPlanPost<T>({
    required int id,
    required String planAssort,
    required String planName,
    required int planCycle,
    required int planProgress,
    required int planPoints,
    required String idDefault,
    required String planStatus,
    required int stepCount,
    required String sleepQuality,
    required String restingHeartRate,
    required String heartRateVariability,
    required int bloodOxygenSaturation,
    required int calorie,
    required String checkInEvent,
    required String emotionManagement,
    required String deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: enableHealthPlanPostPath,
      method: 'POST',
      data: {
        'id': id,
        'planAssort': planAssort,
        'planName': planName,
        'planCycle': planCycle,
        'planProgress': planProgress,
        'planPoints': planPoints,
        'idDefault': idDefault,
        'planStatus': planStatus,
        'stepCount': stepCount,
        'sleepQuality': sleepQuality,
        'restingHeartRate': restingHeartRate,
        'heartRateVariability': heartRateVariability,
        'bloodOxygenSaturation': bloodOxygenSaturation,
        'calorie': calorie,
        'checkInEvent': checkInEvent,
        'emotionManagement': emotionManagement,
        'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///上报压力信息
  Future<T?> addStressChangeInfoPost<T>({
    required String deviceSn,
    required List<Map<String, dynamic>> stress,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addStressChangeInfoPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
        'stress': stress,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///上报心率变异�?
  Future<T?> addHrvPost<T>({
    required String hrv,
    required String deviceSn,
    required String dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addHrvPostPath,
      method: 'POST',
      data: {
        'realHrv': hrv,
        'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///上报血�?
  Future<T?> addBloodOxygenPost<T>({
    required String deviceSn,
    required List<Map<String, dynamic>> bloodOxygen,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addBloodOxygenPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
        'stress': bloodOxygen,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///上报情绪状�?
  Future<T?> addEmoionalInfoPost<T>({
    required String emotionalState,
    required String deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addEmoionalInfoPostPath,
      method: 'POST',
      data: {
        'emotionalState': emotionalState,
        'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///查询饮食记录列表
  Future<T?> queryFoodInfoListGet<T>(
      {required String dailyValue,
      bool isShowErrMsg = true,
      bool isShowLoading = false}) async {
    return await ApiHelper.request<T>(
        path: queryFoodInfoListGetPath,
        method: 'GET',
        queryParameters: {'dailyValue': dailyValue});
  }

  ///上报饮食记录
  Future<T?> addFoodInfoPost<T>({
    required String mealType,
    required String deviceSn,
    File? file,
    String? description,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    final dio.FormData formData = dio.FormData.fromMap({
      'mealType': mealType,
      'deviceSn':deviceSn,
      if (description != null && description.isNotEmpty)
        'description': description,
    });

    if (file != null) {
      final String fileName = file.path.split('/').last;
      formData.files.add(MapEntry(
        'file',
        await dio.MultipartFile.fromFile(file.path, filename: fileName),
      ));
    } else {
      // 没有文件时传空文�?
      formData.files.add(MapEntry(
        'file',
        dio.MultipartFile.fromString('', filename: ''),
      ));
    }

    return await ApiHelper.request<T>(
      path: addFoodInfoPostPath,
      method: 'POST',
      data: formData,
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  ///获取身体状况生命关键指标看板
  Future<T?> queryDashboardGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
    required String? deviceSn,
    required String? dailyValue,
  }) async {
    return await ApiHelper.request<T>(
      path: queryDashboardGetPath,
      method: 'GET',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
    );
  }

  ///生成今日�?
  Future<T?> addTodaySignPost<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
    required String? deviceSn,
  }) async {
    return await ApiHelper.request<T>(
      path: addTodaySignPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
      },
    );
  }

  ///自动分享今日�?
  Future<T?> addAutomaticShareSignPost<T>({
    required String deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addAutomaticShareSignPostPath,
      method: 'POST',
      queryParameters: {
        'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 上报心率信息
  Future<T?> addHeartRateInfoPost<T>({
    required String deviceSn,
    required List<Map<String, dynamic>> heartRate,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addHeartRateInfoPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
        'stress': heartRate,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取心率信息
  Future<T?> getHeartRateInfoGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
    required String? deviceSn,
    String? historyDay,
    String? type,
  }) async {
    return await ApiHelper.request<T>(
      path: getHeartRateInfoGetPath,
      method: 'GET',
      queryParameters: {
        'deviceSn': deviceSn,
        'historyDay': historyDay,
        'type': type,
      },
    );
  }

  /// 上报心率记录
  Future<T?> addHeartRatePost<T>({
    required String heartRate,
    required String deviceSn,
    required String dailyValue,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addHeartRatePostPath,
      method: 'POST',
      data: {
        'heartRate': heartRate,
        'deviceSn': deviceSn,
        'dailyValue': dailyValue
      },
    );
  }

  ///获取所有测量心�?
  Future<T?> queryHeartRateListGet<T>(
      {bool isShowErrMsg = true,
      bool isShowLoading = false,
      required String? deviceSn,
      String? dailyValue}) async {
    return await ApiHelper.request<T>(
      path: queryHeartRateListGetPath,
      method: 'GET',
      queryParameters: {'deviceSn': deviceSn, 'dailyValue': dailyValue},
    );
  }

  ///查询标签列表
  Future<T?> queryDailyTagsListGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryDailyTagsListGetPath,
      method: 'GET',
    );
  }

  ///增加标签
  Future<T?> addDailyTagPost<T>({
    required String tagType,
    required String tagName,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addDailyTagPostPath,
      method: 'POST',
      data: {
        'tagType': tagType,
        'tagName': tagName,
      },
    );
  }

  /// 查询行动列表
  Future<T?> getActionRecordListGet<T>({
    String? actionType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      queryParameters: {'actionType': actionType},
      path: getActionRecordListGetPath,
      method: 'GET',
    );
  }

  /// 上报运动记录
  Future<T?> addSportRecordPost<T>({
    required RingSportRecord sportRecord,
    List<Map<String, dynamic>>? sportList, 
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    // 如果提供�?sportList，使用批量上报格�?
    final data = sportList != null
        ? {
            'deviceSn': sportRecord.deviceSn,
            'stress': sportList, 
          }
        : sportRecord.toJson();
    
    return await ApiHelper.request<T>(
      path: addSportRecordPostPath,
      method: 'POST',
      data: data,
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取最新运动记�?
  Future<T?> getSportRecordGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: getSportRecordGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 上报运动明细
  Future<T?> addSportDetailPost<T>({
    RingSportDetail? sportDetail, // 改为可选参�?
    Map<String, dynamic>? batchData, // 新增：批量上报的完整数据
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    // 如果提供�?batchData，直接使用；否则使用 sportDetail
    final data = batchData ?? sportDetail?.toJson();
    
    if (data == null) {
      throw ArgumentError('sportDetail �?batchData 不能同时为空');
    }
    
    return await ApiHelper.request<T>(
      path: addSportDetailPostPath,
      method: 'POST',
      data: data,
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 短信（国内）
  Future<T?> sendSmsChinaGet<T>(
      {bool isShowErrMsg = true,
      bool isShowLoading = false,
      required String phone,
      String? sceneType}) async {
    return await ApiHelper.request<T>(
      path: sendSmsChinaGetPath,
      method: 'Get',
      queryParameters: {
        'receiveAccount': phone,
        'userType': '1',
        'sceneType': sceneType ?? '1'
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 短信（国际）
  Future<T?> sendSmsInternationalGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
    required String phone,
  }) async {
    return await ApiHelper.request<T>(
      path: sendSmsInternationalGetPath,
      method: 'Get',
      queryParameters: {'receiveAccount': phone, 'userType': '1'},
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 上报锻炼详情
  Future<T?> addExerciseDetailPost<T>({
    required String deviceSn,
    String? exerciseType,
    String? startTime,
    String? endTime,
    List? hrList,
    String? steps,
    String? distance,
    String? calories,
    String? validTime,
    String? rawStartTime,
    String? goalType,
    String? goalValue,
    String? recordDate,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addExerciseDetailPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
        'exerciseType': exerciseType,
        'startTime': startTime,
        'endTime': endTime,
        'hrList': hrList,
        'steps': steps,
        'distance': distance,
        'calories': calories,
        'validTime': validTime,
        'rawStartTime': rawStartTime,
        'goalType': goalType,
        'goalValue': goalValue,
        'recordDate': recordDate,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 通过步数计算每日摄入卡路里，运动消耗时长、运动消耗卡路里
  Future<T?> queryExerciseInfoGet<T>({
    required String stepCount,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryExerciseInfoGetPath.replaceAll(":stepCount", stepCount),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取问卷答案详细信息
  Future<T?> queryQuestionGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryQuestionGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 上报健康问卷
  Future<T?> addHealthQuestionPost<T>({
    // required String deviceSn,
    required String sex,
    required int height,
    required int weight,
    required String birthday,
    required String career,
    required List<HealthQuestionAnswer> exerciseList,
    required List<HealthQuestionAnswer> sleepList,
    required List<HealthQuestionAnswer> dietList,
    required List<HealthQuestionAnswer> emotionList,
    required List<HealthQuestionAnswer> periodList,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    final questionnaireData = HealthQuestionnaireData(
      // deviceSn: deviceSn,
      sex: sex,
      height: height,
      weight: weight,
      birthday: birthday,
      career: career,
      exerciseList: exerciseList,
      sleepList: sleepList,
      dietList: dietList,
      emotionList: emotionList,
      periodList: periodList,
    );

    return await ApiHelper.request<T>(
      path: addQuestionPostPath,
      method: 'POST',
      data: questionnaireData.toJson(),
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 上报健康问卷（使用数据模型）
  Future<T?> addHealthQuestionWithModelPost<T>({
    required HealthQuestionnaireData questionnaireData,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addQuestionPostPath,
      method: 'POST',
      data: questionnaireData.toJson(),
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增或修改生理期信息
  Future<T?> addOrEditPhysiologyPost<T>({
    String? menstrualPeriod, //生理期（记录日用逗号隔开�?
    String? ovulationDay, //排卵�?
    String? ovulationPeriod, //排卵期（记录日用逗号隔开�?
    String? predictMenstrualPeriod, //预测生理期（记录日用逗号隔开�?
    String? updStartDate, //更新本月生理期开始日�?
    String? updEndDate, //更新本月生理期结束日�?
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addOrEditPhysiologyPostPath,
      method: 'POST',
      data: {
        if (menstrualPeriod != null) 'menstrualPeriod': menstrualPeriod,
        if (ovulationDay != null) 'ovulationDay': ovulationDay,
        if (ovulationPeriod != null) 'ovulationPeriod': ovulationPeriod,
        if (predictMenstrualPeriod != null)
          'predictMenstrualPeriod': predictMenstrualPeriod,
        if (updStartDate != null) 'updStartDate': updStartDate,
        if (updEndDate != null) 'updEndDate': updEndDate,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取生理期信息详细信�?
  Future<T?> queryPhysiologyInfoGet<T>({
    int? userId,
    String? selectDate,
    String? updStartDate,
    String? updEndDate,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryPhysiologyInfoGetPath,
      method: 'GET',
      queryParameters: {
        if (userId != null) 'userId': userId,
        if (selectDate != null) 'selectDate': selectDate,
        if (updStartDate != null) 'updStartDate': updStartDate,
        if (updEndDate != null) 'updEndDate': updEndDate,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取生理周期通知信息
  Future<T?> queryReminderInfoGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryReminderInfoGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增或修改生理周期通知信息
  Future<T?> reminderInfoPut<T>({
    String? isMenstrualPeriod,
    String? isOvulationPeriod,
    String? isPeriodDays,
    String? isOvulationPeriodEnd,
    String? reminderTime,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: reminderInfoPutPath,
      method: 'PUT',
      data: {
        if (isMenstrualPeriod != null) 'isMenstrualPeriod': isMenstrualPeriod,
        if (isOvulationPeriod != null) 'isOvulationPeriod': isOvulationPeriod,
        if (isPeriodDays != null) 'isPeriodDays': isPeriodDays,
        if (isOvulationPeriodEnd != null)
          'isOvulationPeriodEnd': isOvulationPeriodEnd,
        if (reminderTime != null) 'reminderTime': reminderTime,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取生理周期设置详细信息
  Future<T?> querySetInfoGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: querySetInfoGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增或修改生理周期设�?
  Future<T?> setInfoPost<T>({
    String? menstrualPeriodDays,
    String? periodDays,
    String? startDate,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: setInfoPostPath,
      method: 'POST',
      data: {
        if (menstrualPeriodDays != null)
          'menstrualPeriodDays': menstrualPeriodDays,
        if (periodDays != null) 'periodDays': periodDays,
        if (startDate != null) 'startDate': startDate,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增戒指固件信息
  Future<T?> addMyInfoPost<T>({
    String? deviceSn,
    String? deviceName,
    String? deviceColor,
    String? deviceSize,
    String? versionNumber,
    String? macAddress,
    String? serialNumber,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addMyInfoPostPath,
      method: 'POST',
      data: {
        if (deviceSn != null) 'deviceSn': deviceSn,
        if (deviceName != null) 'deviceName': deviceName,
        if (deviceColor != null) 'deviceColor': deviceColor,
        if (deviceSize != null) 'deviceSize': deviceSize,
        if (versionNumber != null) 'versionNumber': versionNumber,
        if (macAddress != null) 'macAddress': macAddress,
        if (serialNumber != null) 'serialNumber': serialNumber,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取戒指保修状�?
  Future<T?> queryWarrantyStatusGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryWarrantyStatusGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取戒指固件信息
  Future<T?> queryFirmwareInfoGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryFirmwareInfoGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增我的意见反馈
  Future<T?> addFeedbackPost<T>({
    String? deviceSn,
    String? descProblem,
    String? contactInfo,
    List<dio.MultipartFile>? fileList,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    final formData = dio.FormData();

    // 添加文本字段
    if (deviceSn != null) {
      formData.fields.add(MapEntry('deviceSn', deviceSn));
    }
    if (descProblem != null) {
      formData.fields.add(MapEntry('descProblem', descProblem));
    }
    if (contactInfo != null) {
      formData.fields.add(MapEntry('contactInfo', contactInfo));
    }

    if (fileList != null && fileList.isNotEmpty) {
      for (var file in fileList) {
        formData.files.add(MapEntry('fileList', file));
      }
    }

    return await ApiHelper.request<T>(
      path: addFeedbackPostPath,
      method: 'POST',
      data: formData,
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取我的意见反馈详细信息
  Future<T?> queryFeedbackGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryFeedbackGetPath.replaceAll(':id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询我的意见反馈列表
  Future<T?> queryFeedbackListGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryFeedbackListGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 修改身体状况布局
  Future<T?> editLayoutPut<T>({
    required List<Map<String, dynamic>> layoutList,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: editLayoutPutPath,
      method: 'PUT',
      data: layoutList, // 直接发送数�?
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询身体状况布局
  Future<T?> queryLayoutListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryLayoutList,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增群组
  Future<T?> addGroupPost<T>({
    required String deviceSn,
    required String groupName,
    String? groupCode,
    String? remark,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: addGroupPostPath,
      method: 'POST',
      data: {
        'deviceSn': deviceSn,
        'groupName': groupName,
        'groupCode': groupCode,
        if (remark != null) 'remark': remark,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询群组列表
  Future<T?> queryGroupListGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupListGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取群组详情
  Future<T?> queryGroupGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 修改群组显示顺序
  Future<T?> editGroupSortPut<T>({
    required int id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: editGroupSortPutPath,
      method: 'PUT',
      queryParameters: {
        'id': id,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 申请/邀请加入群�?
  Future<T?> applyJoinGroupPost<T>({
    required String applyInfo,
    required String groupCode,
    required String joinType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: applyJoinGroupPostPath,
      method: 'POST',
      data: {
        'applyInfo': applyInfo, //邀请人输入的手机号或邮�?申请人默认登录账�?
        'groupCode': groupCode, //群组�?
        'joinType': joinType, //1：邀请加�?2：申请加�?
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取群组码ById
  Future<T?> queryGroupCodeByIdGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupCodeByIdGetPath.replaceAll(':id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取群组�?
  Future<T?> queryGroupCodeGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryGroupCodeGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询我的邀请审批后群组消息列表
  Future<T?> queryInviterMessageListGet<T>({
    int? applicantId,
    String? applicantName,
    String? groupName,
    int? groupCreatorId,
    String? groupCode,
    String? approvalState,
    String? applicantTime,
    String? joinType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryInviterMessageListGetPath,
      method: 'GET',
      queryParameters: {
        if (applicantId != null) 'applicantId': applicantId,
        if (applicantName != null) 'applicantName': applicantName,
        if (groupName != null) 'groupName': groupName,
        if (groupCreatorId != null) 'groupCreatorId': groupCreatorId,
        if (groupCode != null) 'groupCode': groupCode,
        if (approvalState != null) 'approvalState': approvalState,
        if (applicantTime != null) 'applicantTime': applicantTime,
        if (joinType != null) 'joinType': joinType,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询我的申请审批后群组消息列�?
  Future<T?> queryApplyMessageListGet<T>({
    int? applicantId,
    String? applicantName,
    String? groupName,
    int? groupCreatorId,
    String? groupCode,
    String? approvalState,
    String? applicantTime,
    String? joinType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryApplyMessageListGetPath,
      method: 'GET',
      queryParameters: {
        if (applicantId != null) 'applicantId': applicantId,
        if (applicantName != null) 'applicantName': applicantName,
        if (groupName != null) 'groupName': groupName,
        if (groupCreatorId != null) 'groupCreatorId': groupCreatorId,
        if (groupCode != null) 'groupCode': groupCode,
        if (approvalState != null) 'approvalState': approvalState,
        if (applicantTime != null) 'applicantTime': applicantTime,
        if (joinType != null) 'joinType': joinType,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询我的申请待审批群组消息列�?
  Future<T?> queryApplyReviewMessageListGet<T>({
    int? applicantId,
    String? applicantName,
    String? groupName,
    int? groupCreatorId,
    String? groupCode,
    String? approvalState,
    String? applicantTime,
    String? joinType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryApplyReviewMessageListGetPath,
      method: 'GET',
      queryParameters: {
        if (applicantId != null) 'applicantId': applicantId,
        if (applicantName != null) 'applicantName': applicantName,
        if (groupName != null) 'groupName': groupName,
        if (groupCreatorId != null) 'groupCreatorId': groupCreatorId,
        if (groupCode != null) 'groupCode': groupCode,
        if (approvalState != null) 'approvalState': approvalState,
        if (applicantTime != null) 'applicantTime': applicantTime,
        if (joinType != null) 'joinType': joinType,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 是否同意加入群组
  Future<T?> approvalPost<T>({
    required int id,
    required int applicantId,
    required String groupCode,
    required String approvalState,
    String? remark,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: approvalPutPath,
      method: 'Put',
      data: {
        'id': id,
        'applicantId': applicantId,
        'groupCode': groupCode,
        'approvalState': approvalState,
        if (remark != null) 'remark': remark,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询减压助眠列表
  Future<T?> queryRelaxInfoListGet<T>({
    String? relaxType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryRelaxInfoListGetPath,
      method: 'GET',
      queryParameters: {
        if (relaxType != null) 'relaxType': relaxType,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取减压助眠信息
  Future<T?> queryRelaxInfoGet<T>({
    int? id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryRelaxInfoGetPath,
      method: 'GET',
      queryParameters: {
        if (id != null) 'id': id,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取减压助眠频次集合
  Future<T?> queryRelaxFrequencyListGet<T>({
    required String relaxType,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryRelaxFrequencyListGetPath.replaceAll(':relaxType', relaxType),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取减压播放返回秒对应吸气、呼气节�?
  Future<T?> queryStressReliefListGet<T>({
    required int minutes,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryStressReliefListGetPath.replaceAll(
          ':minutes', minutes.toString()),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取助眠播放返回秒对应吸气、屏住呼吸、呼气节�?
  Future<T?> querySleepAidListGet<T>({
    required int minutes,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: querySleepAidListGetPath.replaceAll(':minutes', minutes.toString()),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// AI 发送消息（使用 FormData�?
  Future<T?> aiSendPost<T>({
    required String deviceSn,
    int? deviceId,
    String? deviceContent,
    required String chatType,
    required String contentType,
    File? file,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    final dio.FormData formData = dio.FormData.fromMap({
      'deviceSn': deviceSn,
      'chatType': int.tryParse(chatType) ?? chatType, // 尝试转换�?int
      'contentType': int.tryParse(contentType) ?? contentType, // 尝试转换�?int
      if (deviceId != null) 'deviceId': deviceId,
    });

    // 如果有文字内容就�?deviceContent（文字、图�?文字、文�?文字都需要）
    if (deviceContent != null && deviceContent.isNotEmpty) {
      formData.fields.add(MapEntry('deviceContent', deviceContent));
    }

    // 如果有文件，添加�?FormData
    if (file != null) {
      final String fileName = file.path.split('/').last;
      formData.files.add(MapEntry(
        'file',
        await dio.MultipartFile.fromFile(
          file.path,
          filename: fileName,
        ),
      ));
    }

    return await ApiHelper.request<T>(
      path: aiSendPostPath,
      method: 'POST',
      data: formData,
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?手动血氧详�?
  Future<T?> queryBloodOxygenDetailGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryBloodOxygenDetailGetPath.replaceAll(':id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?当天往前取7条血氧数�?
  Future<T?> queryBloodOxygenSevenInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryBloodOxygenSevenInfoGetPath,
      method: 'GET',
      queryParameters: {
        'deviceSn': deviceSn,
        'recordDate': recordDate,
        'type': type
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?手动压力详情
  Future<T?> queryPressureDetailGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryPressureDetailGetPath.replaceAll(':id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?当天往前取7条压力数�?
  Future<T?> queryPressureSevenInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryPressureSevenInfoGetPath,
      method: 'GET',
      queryParameters: {
        'deviceSn': deviceSn,
        'recordDate': recordDate,
        'type': type
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?心率变异性手动详�?
  Future<T?> queryHrvDetailGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHrvDetailGetPath.replaceAll(':id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?当天往前取7条HRV数据
  Future<T?> queryHrvSevenInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHrvSevenInfoGetPath,
      method: 'GET',
      queryParameters: {
        'deviceSn': deviceSn,
        'recordDate': recordDate,
        'type': type
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?心率手动详情
  Future<T?> queryHeartRateDetailGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHeartRateDetailGetPath.replaceAll(':id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 四级�?当天往前取7条心率数�?
  Future<T?> queryHeartRateSevenInfoGet<T>({
    String? deviceSn,
    String? recordDate,
    String? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHeartRateSevenInfoGetPath,
      method: 'GET',
      queryParameters: {
        'deviceSn': deviceSn,
        'recordDate': recordDate,
        'type': type
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 睡眠日历
  Future<T?> querySleepCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: querySleepCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 血氧日�?
  Future<T?> queryBloodOxygenCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryBloodOxygenCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 压力日历
  Future<T?> queryPressureCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryPressureCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 心率变异性日�?
  Future<T?> queryHrvCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHrvCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 心率日历
  Future<T?> queryHeartRateCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryHeartRateCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 活动日历
  Future<T?> queryActivityCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryActivityCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 饮食日历
  Future<T?> queryFoodCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryFoodCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 事件小计日历
  Future<T?> queryEventSubtotalCalendarListGet<T>({
    String? deviceSn,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryEventSubtotalCalendarListGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询应用通知列表
  Future<T?> queryAppNoticeListGet<T>({
    String? noticeType,
    String? status,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryAppNoticeListGetPath,
      method: 'GET',
      queryParameters: {
        if (noticeType != null) 'noticeType': noticeType,
        if (status != null) 'status': status,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取应用通知详细信息（查看并标记为已读）
  Future<T?> queryAppNoticeGet<T>({
    required int noticeId,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryAppNoticeGetPath.replaceAll(':noticeId', noticeId.toString()),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取应用通知信息（获取最新的生理期通知�?
  Future<T?> queryAppNoticeInfoGet<T>({
    String? noticeType,
    bool isShowErrMsg = false,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryAppNoticeInfoGetPath,
      method: 'GET',
      queryParameters: {
        if (noticeType != null) 'noticeType': noticeType,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询小睡数据
  /// type: 1=�? 2=�? 3=�?
  Future<T?> queryShortSleepGet<T>({
    String? deviceSn,
    String? dailyValue,
    int? type,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShortSleepGetPath,
      method: 'GET',
      queryParameters: {
        if (deviceSn != null) 'deviceSn': deviceSn,
        if (dailyValue != null) 'dailyValue': dailyValue,
        if (type != null) 'type': type,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询积分商城产品列表
  Future<T?> queryShopProductsGet<T>({
    int? pageNum,
    int? pageSize,
    String? orderByColumn,
    String? isAsc,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShopProductsGetPath,
      method: 'GET',
      queryParameters: {
        if (pageNum != null) 'pageNum': pageNum,
        if (pageSize != null) 'pageSize': pageSize,
        if (orderByColumn != null) 'orderByColumn': orderByColumn,
        if (isAsc != null) 'isAsc': isAsc,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询商品详情
  Future<T?> queryShopProductDetailGet<T>({
    required int id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: '$queryShopProductDetailGetPath/$id',
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 积分商品兑换
  Future<T?> exchangeProductPost<T>({
    required String productsId,
    required String addressId,
    required String productCount,
    bool isShowErrMsg = true,
    bool isShowLoading = true,
  }) async {
    return await ApiHelper.request<T>(
      path: exchangeProductPostPath,
      method: 'POST',
      data: {
        'productsId': productsId,
        'addressId': addressId,
        'productCount': productCount,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询兑换订单列表
  Future<T?> queryShopPointsOrdersGet<T>({
    int? pageNum,
    int? pageSize,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShopPointsOrdersGetPath,
      method: 'GET',
      queryParameters: {
        if (pageNum != null) 'pageNum': pageNum,
        if (pageSize != null) 'pageSize': pageSize,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询兑换订单详情
  Future<T?> queryShopPointsOrderDetailGet<T>({
    required int id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: '$queryShopPointsOrderDetailGetPath/$id',
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 查询积分明细
  Future<T?> queryShopPointsIncomeGet<T>({
    int? pageNum,
    int? pageSize,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShopPointsIncomeGetPath,
      method: 'GET',
      queryParameters: {
        if (pageNum != null) 'pageNum': pageNum,
        if (pageSize != null) 'pageSize': pageSize,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 新增收货地址
  Future<T?> addShippingAddressPost<T>({
    required String recipientName,
    required String recipientPhone,
    required String province,
    required String city,
    required String district,
    required String detailedAddress,
    required String isDefault,
    bool isShowErrMsg = true,
    bool isShowLoading = true,
  }) async {
    return await ApiHelper.request<T>(
      path: addShippingAddressPostPath,
      method: 'POST',
      data: {
        'recipientName': recipientName,
        'recipientPhone': recipientPhone,
        'province': province,
        'city': city,
        'district': district,
        'detailedAddress': detailedAddress,
        'isDefault': isDefault,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 修改收货地址
  Future<T?> updateShippingAddressPut<T>({
    required int id,
    required String recipientName,
    required String recipientPhone,
    required String province,
    required String city,
    required String district,
    required String detailedAddress,
    required String isDefault,
    bool isShowErrMsg = true,
    bool isShowLoading = true,
  }) async {
    return await ApiHelper.request<T>(
      path: updateShippingAddressPutPath,
      method: 'PUT',
      data: {
        'id': id,
        'recipientName': recipientName,
        'recipientPhone': recipientPhone,
        'province': province,
        'city': city,
        'district': district,
        'detailedAddress': detailedAddress,
        'isDefault': isDefault,
      },
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 删除收货地址
  Future<T?> deleteShippingAddressDel<T>({
    required String ids,
    bool isShowErrMsg = true,
    bool isShowLoading = true,
  }) async {
    return await ApiHelper.request<T>(
      path: deleteShippingAddressDelPath.replaceAll(':ids', ids),
      method: 'DELETE',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 收货地址详情
  Future<T?> queryShippingAddressDetailGet<T>({
    required String id,
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShippingAddressDetailGetPath.replaceAll('id', id),
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 收货地址列表
  Future<T?> queryShippingAddressListGet<T>({
    bool isShowErrMsg = true,
    bool isShowLoading = false,
  }) async {
    return await ApiHelper.request<T>(
      path: queryShippingAddressListGetPath,
      method: 'GET',
      isShowErrMsg: isShowErrMsg,
      isShowLoading: isShowLoading,
    );
  }

  /// 获取省市区数据
  Future<List<Map<String, dynamic>>> queryProvinceGet() async {
    try {
      final response = await DioClient().dio.get(
        queryProvinceGetPath,
        options: dio.Options(responseType: dio.ResponseType.plain),
      );
      
      if (response.statusCode == 200 && response.data != null) {
        final data = response.data;
        if (data is String) {
          final jsonData = json.decode(data);
          if (jsonData is List) {
            return List<Map<String, dynamic>>.from(jsonData);
          }
        }
      }
      return [];
    } catch (e) {
      print('获取省市区数据失败: $e');
      return [];
    }
  }

  
}


